#ifndef IMAGE3D_H
#define IMAGE3D_H


#include <QtOpenGL>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <QObject>
#include <QFile>
#include <QTextStream>
#include <QIODevice>
#include <cassert>


#include "camera.h"


#define TOP    0
#define BOTTOM 1
#define FRONT  2
#define BACK   3
#define LEFT   4
#define RIGHT  5



class Image3D
{
    std::vector<unsigned short> image3D;
    unsigned width;
    unsigned height;
    unsigned depth;
    unsigned greyMax;

    friend std::ostream& operator<< (std::ostream&, const Image3D&);

    // indice de la couche de coupe
    unsigned Ycouches;


private :

    unsigned drawCube(unsigned x, unsigned y, unsigned z, const float);
    bool     isConnected(const unsigned short, const unsigned, const unsigned,
                         const unsigned, const unsigned) const;

    void     drawLayer();

public :

    Image3D (char* );

    unsigned draw();       // renvoie le nombre de faces affichées
    void     addLayer();
    void     removeLayer();
    unsigned getLayer();

};

#endif // IMAGE3D_H
